const path = require('path')
const MiniCssExtractPlugin =require('mini-css-extract-plugin')
module.exports = {
    module: {
        rules: [
            {
                test: /\.js$/,
                include:path.resolve(__dirname,'src'),
                exclude: /node_modules/,
                use:['babel-loader']
            },
            {
                // 使用scss之前，也要安装node-sass
                test: /\.scss$/,
                use: [
                    // 可以替代了style-loader
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'sass-loader'
                ]
            }, {
                test: /\.css$/,
                use:['style-loader','css-loader']
            },
                //解析不同类型的文件，有些不太明白，之后查
            {
                test: /\.(woff|woff2|eot|ttf|svg)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            publicPath: 'asset/iconfont',
                            outputPath:'assets/icon'
                        }
                    }
                ]
            }
        ]
            
    }
}